package com.wrk._1_语法._03_分支;

import java.util.Scanner;

public class _006_计算器 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double result=0;
        //输入第一个数
        System.out.println("请输入第一个数:");
        double number1 = scanner.nextDouble();
        //输入第二个数
        System.out.println("请输入第二个数:");
        double number2 = scanner.nextDouble();
        //输入运算符
        System.out.println("请输入符号:");
        char operator = scanner.next().charAt(0);
        //判断
        switch (operator){
            case '+':
                result =number1+number2;
                break;
            case '-':
                result =number1-number2;
                break;
            case '*':
                result =number1*number2;
                break;
            case '/':
                result =number1/number2;
                break;
        }
        System.out.println(result);
        scanner.close();
    }
}
